<?php
////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.sf.net                                                  //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
$rights = &$system->rights;
$root   = &$system->root;
if (empty($rights) && !$root) {
    $frm =new InputForm (RCMS_ROOT_PATH, 'get', __('Return'), '_top');
    $frm->addbreak(__('You are not administrator of this site'));
    $frm->show();
} else {
    if(isset($_POST['remarks'])) file_write_contents(DATA_PATH . 'admin_remarks.txt', $_POST['remarks']);
    $frm = new InputForm ('', 'post', __('Submit'));
    $frm->addbreak(__('Welcome to administration panel'));
    if(!$root) {
        foreach ($rights as $right => $right_desc) {
            $frm->addrow($right, $right_desc, 'top');
        }
    } else {
        $frm->addrow(__('You have all rights on this site'));
    }
    $frm->addbreak(__('Information'));
    $frm->addrow('ReloadCMS ' . RCMS_VERSION_A . '.'  . RCMS_VERSION_B . '.' . RCMS_VERSION_C . RCMS_VERSION_SUFFIX, $_SERVER['SERVER_SIGNATURE']);
        
    if($system->checkForRight('ARTICLES-EDITOR')){
        $articles = new articles();
        $articles->setWorkContainer('#hidden');
        $count = sizeof($articles->getArticles(0, false, false, false));
        $frm->addrow($count . ' ' . __('article(s) awaits moderation'));
    }
    if($system->checkForRight('SUPPORT')) {
        $count = sizeof(guestbook_get_msgs(null, true, false, DF_PATH . 'support.dat'));
        $frm->addrow($count . ' ' . __('support requests in database'));
    }
     $frm->addbreak(__('Shortcuts'));
    $frm->addrow(file_get_contents(DATA_PATH . 'shortcuts.dat'));
    $frm->addbreak(__('Here you can leave message for other administrators'));
    $frm->addrow($frm->textarea('remarks', file_get_contents(DATA_PATH . 'admin_remarks.txt'), 60, 10), '', 'middle', 'center');
    $frm->show();
}
?>